/**
 * 
 * @author bigk
 * @version 0.8.5
 * 
 * 
 * Copyright (C) 2012  bigktheone@gmail.com

 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.

 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.

 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
 */
package bigk.pluzzdl.model;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

import bigk.pluzzdl.Globals;
import bigk.pluzzdl.Logger;

public class ProgramFile {
	
	private Logger m_logger;
	
	private String m_title;
	private String m_synopsis;
	private Date m_date;
	private String m_link;
	
	public ProgramFile() {
		m_logger = Logger.getLogger(ProgramFile.class.getName());
		Globals.setupLogger(Globals.APP_LEVEL, m_logger);

	}
	
	public ProgramFile(Date date) {
		this();
		m_date = date;
	}
	
	public ProgramFile(String date) throws ParseException {
		this(new SimpleDateFormat("dd-MM-yyyy").parse(date));
	}
	
	public String getDateAsString() {
		return new SimpleDateFormat("dd-MM-yyyy").format(m_date);
	}
	

	public String getTitle() {
		return m_title;
	}



	public void setTitre(String title) {
		m_title = title;
	}

	
	

	public String getSynopsis() {
		return m_synopsis;
	}



	public void setSynopsis(String synopsis) {
		m_synopsis = synopsis;
	}



	public Date getDate() {
		return m_date;
	}



	public void setDate(Date date) {
		this.m_date = date;
	}



	public String getLink() {
		return m_link;
	}



	public void setLink(String link) {
		m_link = link;
	}
	
	



	@Override
	public String toString() {
		return "title : " + m_title +"\n" +
				"synopsis : " + m_synopsis + "\n" +
				"date de diffusion : " + Program.FORMATTER.format(m_date) + "\n";
	}

	

	@Override
	public boolean equals(Object p) {
		if (getDateAsString().equals(((ProgramFile)p).getDateAsString())) {
			return true;
		}
		return false;
	}
}
